# diet1.mod
# This model uses sets. 
#--------------------------------------------------
# To display information about the constraints type
# display diet.lb, diet.body, diet.ub; 

set NUTR;

set FOOD;

param cost {FOOD} > 0;

param f_min {FOOD} >= 0;

# added upper limits on the number of packages in a diet. 
param f_max {j in FOOD} >= f_min[j];

# upper and lower limits on the weekly amount for each nutrient. 
param n_min {NUTR} >= 0;

param n_max {i in NUTR} >= n_min[i];


param amt {NUTR,FOOD} >= 0;
 

var Buy {j in FOOD} >= f_min[j], <= f_max[j];


minimize total_cost: sum {j in FOOD} cost[j] * Buy[j];

subject to diet {i in NUTR}:

n_min[i] <= sum {j in FOOD} amt[i,j] * Buy[j] <= n_max[i]; 



# after solving try typing 
# let n_max["C"] := 700;
# resolve to see what happens
# let {f in FOOD} f_min[f]:= 0;


